const tomatoData = {
	state: {
		tomato: []
	},
	mutations: {
		getTomato(state) {
			state.tomato = JSON.parse(uni.getStorageSync('tomato') || '[]')
		},
		addTomato(state, payload) {
			if (payload.time === undefined) {
				return
			} else {
				this.commit("getTomato")
				state.tomato.push({
					time: payload.time,
					note: payload.note
				})
				uni.setStorageSync('tomato', JSON.stringify(state.tomato))
			}
		},
		delTomato(state, payload) {
			this.commit("getTodolist")
			state.tomato.splice(payload, 1)
			uni.setStorageSync('tomato', JSON.stringify(state.tomato))
		},

	}
}

export default tomatoData;
